package com.yidu.best.bond.clear.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yidu.best.bond.clear.dao.CapitalTransferDao;
import com.yidu.best.bond.clear.domain.CapitalTransfer;
import com.yidu.best.bond.clear.domain.CapitalTransferVo;
import com.yidu.best.bond.clear.service.CapitalTransferService;

@Service
public class CapitalTransferServiceImpl implements CapitalTransferService{
	@Autowired
	private CapitalTransferDao capitalTransferDao;
	
	@Override
	public Map<String, Object> findPageQuery(CapitalTransferVo capitalTransferVo) {
		// 调用dao层方法查询数量
		int count = capitalTransferDao.countCapitalTransfer(capitalTransferVo);
		// 计算页码
		int page = (capitalTransferVo.getPage() - 1) * capitalTransferVo.getLimit();
		capitalTransferVo.setPage(page);
		// 调用dao层方法分页查询
		List<CapitalTransfer> capitalTransferList = capitalTransferDao.findPageQuery(capitalTransferVo);
		Map<String, Object> map = new HashMap<String, Object>();
		// 将数据存入map中
		map.put("code", 0);
		map.put("count", count);
		map.put("data", capitalTransferList);
		return map;

	}

}
